#pragma once
#include<iostream>
#include<vector>
#include<graphics.h>
#include<fstream>
#include"Block.h"
using namespace std;
class Tetris
{
public:
	Tetris(int rows, int cols, int left, int top, int BlockSize);
	void init();
	void play();
	void keyEvent();
	void updateWindow();
	int getDelay();
	void rotate();
	void moveLeftRight(int offset);
	void clearLine();
	void drop();
	void drawScore();
	void checkOver();
	void saveScore();
	void displayOver();
public:
	vector<vector<int>>map;
private:
	int delay;
	bool update;
	int blockType;
	int rows;
	int cols;
	int leftMargin;
	int topMargin;
	int blockSize;
	int score;
	int lineCount;
	int highscore;
	int level;
	IMAGE imgBg;
	Block* curBlock;
	Block* nextBlock;
	Block bakBlock;
	bool gameOver;
	IMAGE imgOver;
	IMAGE imgWin;
};

